<?php
declare (strict_types = 1);

namespace app\middleware;

use app\admin\model\User;
use app\BaseController;
use think\Response;

class ApiMiddleware extends BaseController
{
    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure       $next
     * @return Response
     */
    public function handle($request, \Closure $next)
    {

        if (!isset($this->userData['data'])){
            return $this->out_json('由于你长时间未操作，请重新登陆');
        }

//        $manager = $this->userData['data']->id;
//        $login_str = User::where('id', $manager)->value('login_str');
//
//
//        if ($this->userData['data']->login_str != $login_str) {
//            return $this->out_json('该账户已在其它设备登陆，如非本人操作请尽快修改密码');
//        }

        return $next($request);

    }
}
